package com.donquijote.dynamic.controller;

import com.donquijote.dynamic.config.NewTimerProxy;
import com.donquijote.dynamic.config.TimerProxy;
import com.donquijote.dynamic.service.OrderService;
import com.donquijote.dynamic.service.impl.OrderServiceImpl;

import java.lang.reflect.Proxy;

/**
 * @author 421527548@qq.com
 * @version V1.0
 * @title
 * @description
 * @date 2022-11-27 09:12
 */
public class OrderController {

    public static void main(String[] args) {
        OrderService orderService = new OrderServiceImpl();
//        OrderService proxyInstance = (OrderService) Proxy.newProxyInstance(orderService.getClass().getClassLoader(), orderService.getClass().getInterfaces(), new TimerProxy(orderService));
        OrderService proxyInstance = (OrderService) NewTimerProxy.newInstance(orderService);
        proxyInstance.insertOrder();
        proxyInstance.modifyOrder();
        proxyInstance.queryOrder();
    }
}
